package semSimilarity.test;

public class Pair<T> {
	
	
	private T element1;
	private T element2;
	public T getElement1() {
		return element1;
	}
	public void setElement1(T element1) {
		this.element1 = element1;
	}
	public T getElement2() {
		return element2;
	}
	public void setElement2(T element2) {
		this.element2 = element2;
	}
	public Pair(T element1, T element2) {
		super();
		this.element1 = element1;
		this.element2 = element2;
	}
	

	@SuppressWarnings("unchecked")
	@Override
	public boolean equals(Object obj){
		Pair<T> pair;
		try {
		pair = (Pair<T>) obj;

	    return ((pair.element1.equals(this.element1)&&pair.element2.equals(this.element2))
						||(pair.element1.equals(this.element2)&&pair.element2.equals(this.element1)));
		}
		catch (Exception e){
			return false;
		}
	
		
		
	}
	
	public int hashCode (){
		
		return element1.hashCode()+element2.hashCode();
		
	}

}
